﻿<script language="javascript">
	
	function addCNBM()
	{
		window.location = "admin_cpanel.php?part=addcnbm";
	}
	
	function editCNBM(id)
	{
		location.href = "admin_cpanel.php?part=editcnbm&msbm=" + id;
	}	
	
	function delCNBM(id)
	{
		if (confirm("Bạn có chắc muốn xóa?"))
			location.href = "../Modules/admin_xoacnbm.php?msbm=" + id;
	}
	
	function chgPassCNBM(id)
	{
		location.href = "admin_cpanel.php?part=chgpass&acctype=cnbm&msbm=" + id;
	}
	
</script>

<div>
<?php

include("../../Modules/conn.php");

$query = "select * from bo_mon";
$result = mysql_query($query, $conn) or die(mysql_error());

?>

<h4>Quản lý tài khoản bộ môn</h4>

<table>
	<tr>
		<th>Mã bộ môn</th>
		<th>Tên bộ môn</th>
	</tr>
	
<?php

while ($row = mysql_fetch_array($result))
{
	echo '
	<tr>
		<td>'.$row['MSBM'].'</td>
		<td>'.$row['TEN_BM'].'</td>
		<td><input type="button" value="Sửa" onclick="editCNBM('.$row['MSBM'].')"></td>
		<td><input type="button" value="Xóa" onclick="delCNBM('.$row['MSBM'].')"></td>
		<td><input type="button" value="Đổi mật khẩu" onclick="chgPassCNBM('.$row['MSBM'].')"></td>
	</tr>';
}

?>

</table>				

<input type="button" value="Thêm mới" name="btnAdd" onClick="addCNBM();">

</div>
